class @CategoryNavigationView extends CustomView
    initialize: ->
        super
        @model.bind("change", @render)
        @model.fetch()

    events:
        "click li.parent>a": "toggle"   

    toggle: (e) ->
        e.preventDefault()
        $(e.target).closest("li.parent").find("li.child").toggle("blind")
  
    render: ->
        @GetTemplate(SiteMap.Categories.NavigationTemplate, (compiledTemplate) =>
            $(@el).html(compiledTemplate(@model.toJSON()))
        )